<template>
  <div>
    <el-select v-model="form.store" size="small" value-key="storeId" placeholder="请选择" @change="changeStoreId">
      <el-option
        v-for="item in list"
        :key="item.storeId"
        :label="item.name"
        :value="item"
      />
    </el-select>
  </div>
</template>

<script>
import { storeList } from '@/views/wxaMallModule/api/shop'
export default {
  data() {
    return {
      // 配置
      // 状态
      // 数据
      list: [],
      form: {
        store: null
      }
    }
  },
  computed: {},
  watch: {},
  beforeCreate() {
  },
  created() {
  },
  beforeMount() {
  },
  mounted() {
    this.fetchData()
  },
  beforeUpdate() {
  },
  update() {
  },
  activated() {
  },
  deactivated() {
  },
  beforeDestroy() {
  },
  destroyed() {
  },
  methods: {
    /**
     * 数据组
     */
    // 获取列表
    fetchData() {
      const params = {
        disabled: false
      }
      storeList(params).then(res => {
        this.list = res.data || []
        if (this.list.length) {
          this.form.store = this.list[0]
          this.changeStoreId(this.form.store)
        }
      })
    },
    /**
     * 按钮组
     */
    /**
     * 状态组
     */
    // 门店改变
    changeStoreId(value) {
      console.log(value)
      if (value) this.$emit('emitStore', value)
    }
    /**
     * 方法组
     */
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>

</style>
